<?php

namespace app\shop\model\company;

use think\Model;
use app\shop\model\user\User;
use think\model\concern\SoftDelete;
/**
 * 应用模型
 */
class InterviewLog extends Model
{
    use SoftDelete;
    protected $autoWriteTimestamp = true;

    public function user()
    {
        return $this->belongsTo(User::class, 'interviewer', 'user_id');
    }


    public function getResultTextAttr($value, $data)
    {
        if (!$data['result']) {
            return '未面试';
        }
        $result = ['未面试', '通过', '未通过'];
        return $result[$data['result']];
    }

    public function getInterviewTimeAttr($value)
    {
        return $value ? date('Y-m-d H:i', $value) : "";
    }

    public function setInterviewTimeAttr($value)
    {
        return strtotime($value);
    }
}
